package com.kkyy.msystem.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kkyy.msystem.dao.UsersDao;
import com.kkyy.msystem.entity.UsersEntity;
import com.kkyy.msystem.service.UsersService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UsersServiceImpl extends ServiceImpl<UsersDao, UsersEntity> implements UsersService {
    @Override
    public void usersdelete(String id) {
        this.baseMapper.deleteById(id);
    }

    @Override
    public UsersEntity getUserByUsername(String username) {
        UsersEntity usersEntity = this.baseMapper.getUserByUsername(username);
        return usersEntity;
    }

    @Override
    public void setpermissionById(Integer id) {
        baseMapper.updatePermissionById(id);
    }

    @Override
    public void setpermissionById2(Integer id) {
        baseMapper.updatePermissionById2(id);
    }

    @Override
    public List<UsersEntity> getUsersList() {
        return baseMapper.selectList(new QueryWrapper<>());
    }

    @Override
    public UsersEntity getUserByUserId(String id) {
        return baseMapper.selectById(id);
    }

    @Override
    public void updateUser(String id, String mobile, String fullname) {
        baseMapper.updateUser(id, mobile, fullname);
    }
}